<?php

class controller_upload extends controller_theme
{
	public function __construct()
	{
		parent::__construct();
	}
	

	// 上传图像 jpg, gif, png
	public function upload_image()
	{
		$template = bone::get_template('upload.upload_image', APP_DIR);
		$template->set_title('上传图像文件');
		$template->set_data($this->get_data());
		$template->display();
	}
	public function upload_image_save()
	{

	}

	// 上传音频， 视频， flash 等	mp3/wav/mp4/wmv/avi/swf/.....
	public function upload_media()
	{
		$template = bone::get_template('upload.upload_media', APP_DIR);
		$template->set_title('上传媒体文件');
		$template->set_data($this->get_data());
		$template->display();
	}
	public function upload_media_save()
	{

	}

	// 上传文档		doc/pdf/zip/rar/.....
	public function upload_archive()
	{
		$template = bone::get_template('upload.upload_archive', APP_DIR);
		$template->set_title('上传普通文件');
		$template->set_data($this->get_data());
		$template->display();
	}
	public function upload_archive_save()
	{

	}


	public function ajax_delete()
	{
		$id = get('id', 0, 'int');
		if($id==0)
		{
			$this->set_ajax('status', 1);
			$this->set_ajax('description', '参数{id}缺失');
			$this->ajax();
		}

		$model = bone::get_model('upload', APP_DIR);
		if( $model->delete($id) )
		{
			$this->set_ajax('status', 0);
			$this->set_ajax('description', '删除成功');
			$this->ajax();
		}
		else
		{
			$this->set_ajax('status', 2);
			$this->set_ajax('description', $model->get_error() );
			$this->ajax();
		}
	}


	
}
?>